<form method="post" enctype="multipart/form-data" target="_blank" id="form-order">
    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <!-- <td style="width: 1px;" class="text-center"> -->
                <!--
                    <input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);">
                -->    
                <!-- </td> -->
                <td class="text-center" style="background: #fff;"> </td>
                <td class="text-right">
                    <a href="javascript:sort('goods_id');">ID</a>
                </td>
                <td class="text-left">
                    <a href="javascript:sort('goods_name');">产品名称</a>
                </td>

                <td class="text-left">
                    <a href="javascript:sort('goods_name');">规格名称</a>
                </td>

                <td class="text-left">
                    <a href="javascript:sort('cat_id');">分类</a>
                </td>                
                <td class="text-left">
                    <a href="javascript:sort('price');">价格</a>
                </td>
                <td class="text-left">
                    <a href="javascript:sort('qipi_num');">起批量</a>
                </td>
                 <td class="text-left">
                    <a href="javascript:sort('shop_price');">浮价</a>
                </td>
				<td class="text-left">
				    <a href="javascript:sort('sku');">SKU</a>
				</td>
				<td class="text-left">
				    <a href="javascript:sort('spu');">单位</a>
				</td>
                <td class="text-left">
				    <a href="javascript:sort('store_count');">库存</a>
				</td>

                <td class="text-center">
                    <a href="javascript:sort('goods_state');">状态</a>
                </td>
				<td class="text-center">上架时间</td>
            </tr>
            </thead>
            <tbody>
            <volist name="goodsList" id="list">
                <tr>
                    <td> <label style="width: 100%;height: 100%"><input type="checkbox" name="key[]"  value="{$list.key}"></label> </td>
                    <td class="text-right">{$list.goods_id}
					<input type="hidden" name="shipping_code[]" value="flat.flat">
					</td>
                    <td class="text-left">{$list.goods_name|getSubstr=0,33}</td>
                    <td class="text-left">{$list.key_name}</td>
                    <td class="text-left">{$catList[$list[cat_id3]][name]}</td>
                    <td class="text-left">
                        <input type="text"  onchange="updateSort2('spec_goods_price','key','{$list.key}','price',this)" size="4" value="{$list.item_price}" style="width: 90px"/>
                    </td>
                    <td class="text-left">
                        <input type="text"  onchange="updateSort2('spec_goods_price','key','{$list.key}','qipi_num',this)" size="4" value="{$list.qipi_num}" style="width: 90px"/>
                    </td>
                     <td class="text-left">
                        {$list.floating}%
                    </td>
					<td class="text-center" style="color:red;">
					<input type="text"  onchange="updateSort2('spec_goods_price','key','{$list.key}','sku',this)" size="4" value="{$list.sku}" style="width: 150px"/>
					</td>
					<td class="text-center" style="color:red;">
					<input type="text"  onchange="updateSort2('spec_goods_price','key','{$list.key}','spu',this)" size="4" value="{$list.spu}" style="width: 150px"/>
					</td>
                    <td class="text-left"><input type="text" onchange="updateSort2('spec_goods_price','key','{$list.key}','store_count',this)" value="{$list.store_count}" class="input-sm" style="width: 150px;text-align: center;">
					</td>
					<if condition="$list[is_delete] eq 0">
                    <td class="text-left">
					<span onmouseover="layer.tips('{$list.zhuangtai}',this,{tips: [1, '#000']});" onmouseout="layer.closeAll();">
                    <if condition="$list[goods_state] eq 0">待审核</if>
                    <if condition="$list[goods_state] eq 1">出售中</if>
                    <if condition="$list[goods_state] eq 2">审核失败</if>
                    <if condition="$list[goods_state] eq 3">违规下架</if>
					</span>
                    </td>
					<else />
					<td class="text-left">
					 下架
					</td>
					</if>
			<td class="text-center">{$list.on_time|date='Y-m-d H:i:s',###}</td>
                </tr>
            </volist>
            </tbody>
        </table>
    </div>
</form>
<div class="row">
    <div class="navbar-form form-inline" style="float: left;">
        全选
        <input type="checkbox" onclick="$('input[name=\'key\[\]\']').prop('checked', this.checked);">
        <div class="form-group" style="margin-left:20px;">
            <input type="text" id="func_id" size="20" value="" />
        </div>

        <button id="act_button" type="button" onclick="act_submit('store_count');" class="btn btn-primary"><i class="fa"></i>批量设置库存</button>
        <button id="act_button1" type="button" onclick="act_submit('floating');" class="btn btn-primary"><i class="fa"></i>批量设置浮价</button>
    </div>
    <div class="col-sm-9 text-right">{$page}</div>
</div>
<script>
    // 点击分页触发的事件
    $(".pagination  a").click(function(){
        cur_page = $(this).data('p');
        ajax_get_table('search-form2',cur_page);
    });



        //获取选中商品id
    function get_select_goods_id_str() {
        if ($('input[name="key\[\]"]:checked').length == 0)
            return false;
        var goods_arr = Array();
        $('input[name="key\[\]"]:checked').each(function () {
            goods_arr.push($(this).val());
        });
        var goods_id_str = goods_arr.join(',');
        return goods_id_str
    }


        //批量操作提交
    function act_submit(action) {
        var cur_page = $('.pagination  a').data('p');
        //prompt层
        var type = $("#func_id").val();

       
        var keys = get_select_goods_id_str();
        if (keys == false) {
            layer.alert('请勾选要操作的商品', {icon: 2});
            return;
        }

        if (type == '') {
            layer.alert('请填写浮价', {icon: 2});
            return;
        }


        $.ajax({
            type: "POST",
            url: "/index.php/Seller/goods/goods_actions_item",
            data: {keys:keys,val:type,action:action},
            success: function (result) {
                if(result=='0'){
                    var index = layer.alert('商品修改成功！', {icon: 6},function(e){

                        ajax_get_table('search-form2',cur_page+1);
                        layer.close(index)
                    });
                }else{
                    layer.alert('系统错误！', {icon: 5});
                }
            },
            error:function(){
                layer.alert('网络异常', {icon: 2,time: 3000});
            }
        });
    }



</script>